package com.cy.sys_paper.controller;

/**
 * @author cyljx
 * @program: question-project
 * @description:
 * @date 2022-02-12 14:39:29
 */

import com.cy.sys_paper.entity.SysPaper;
import com.cy.sys_paper.service.SysPaperService;
import com.cy.utils.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 试题模块控制器
 */
@RestController
@RequestMapping("/api/syspaper")
public class SysPaperController {
    @Autowired
    private SysPaperService sysPaperService;

    //保存试题
    @PostMapping("/savePaper")
    public CommonResult<String> savePaper(@RequestBody List<SysPaper> paperList){
        sysPaperService.savePaper(paperList);
        return CommonResult.success("设计试题成功!");
    }

    @GetMapping("/gerPaperList")
    public CommonResult<List<SysPaper>> getPaperList(String questionId){
        List<SysPaper> list = sysPaperService.getList(questionId);
        return CommonResult.success("试题列表查询成功",list);
    }
}
